chore: improve mixed models#1645
Conversation
ee00fb3 to
c047e45
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR improves the support for mixed models by enabling nearby features and updating the configuration, heuristic, and move selector components accordingly while re-enabling mixed model tests. Key changes include:
- New documentation describing mixed modeling and construction heuristics.
- Re-enabling and adjusting tests for mixed model scenarios.
- Updating phase, heuristic, and move selector configuration to support mixed models (including nearby setting adjustments).
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| docs/src/modules/ROOT/pages/optimization-algorithms/construction-heuristics.adoc | Adds documentation for mixed modeling and construction heuristics. |
| core/src/test/java/ai/timefold/solver/core/impl/solver/DefaultSolverTest.java | Re-enables and updates mixed model test cases. |
| core/src/test/java/ai/timefold/solver/core/impl/heuristic/selector/move/generic/list/SubListSwapMoveSelectorFactoryTest.java core/src/test/java/ai/timefold/solver/core/impl/heuristic/selector/move/generic/list/SubListChangeMoveSelectorFactoryTest.java core/src/test/java/ai/timefold/solver/core/impl/constructionheuristic/DefaultConstructionHeuristicPhaseTest.java |
Removes previously disabled mixed model tests. |
| core/src/main/java/ai/timefold/solver/core/impl/phase/PhaseFactory.java | Adds logic to disable nearby settings for mixed models and updates config policy accordingly. |
| core/src/main/java/ai/timefold/solver/core/impl/heuristic/selector/list/SubListSelectorFactory.java | Ensures a variable name is set for mixed models when none is provided. |
| core/src/main/java/ai/timefold/solver/core/impl/heuristic/HeuristicConfigPolicy.java | Adds a method to copy config policy without nearby settings. |
| Core configuration files for move selector configs (KOpt, ListSwap, ListChange, TailChainSwap, Swap, Change, Union) and NearbyAutoConfigurationEnabled.java | Updates implementations of canEnableNearbyInMixedModels according to mixed model requirements. |
Comments suppressed due to low confidence (3)
core/src/main/java/ai/timefold/solver/core/impl/heuristic/selector/list/SubListSelectorFactory.java:119
- [nitpick] When automatically setting the variable name for mixed models, consider adding a validation or clarifying comment to ensure the correct list variable is selected if multiple exist.
if (configPolicy.getSolutionDescriptor().hasBothBasicAndListVariables() && valueSelectorConfig.getVariableName() == null) {
core/src/main/java/ai/timefold/solver/core/impl/phase/PhaseFactory.java:71
- [nitpick] Consider adding a brief inline comment explaining why disabling the nearby setting is necessary for mixed models to improve future maintainability.
var disableNearbySetting = configPolicy.getNearbyDistanceMeterClass() != null && entityPlacerConfig != null && QueuedEntityPlacerConfig.class.isAssignableFrom(entityPlacerConfig.getClass()) && configPolicy.getSolutionDescriptor().hasBothBasicAndListVariables();
core/src/test/java/ai/timefold/solver/core/impl/solver/DefaultSolverTest.java:1657
- With the re-enabling of mixed model tests, verify that sufficient tests exist for both success and failure scenarios to ensure stable behavior in edge cases.
void failMixedModel() {
7759cfa to
7df5be8
Compare
The coverage is achieved through the new tests on the enterprise repository, and duplication does not seem important. |
triceo
left a comment
There was a problem hiding this comment.
LGTM when comments resolved.
|


This PR includes improvements necessary for configuring the nearby features. All related tests were added to the enterprise repo.